<template>
  <div class="warrper">
    <!-- <editor id="tinymce" v-model="tinymceHtml" :init="init"></editor> -->
     <!-- <button @click="btn">点击</button> -->
    <!-- <div v-html="tinymceHtml"></div> -->
    <!-- <el-tree :props="props" :load="loadNode" lazy :expand-on-click-node="false">
      <span class="custom-tree-node" slot-scope="{ node, data }">
        <span>{{ node.label }}</span>
        <span>
          <el-button type="text" size="mini" @click="() => append(node, data)">
            +
          </el-button>
        </span>
      </span>
    </el-tree> -->
    <sendDialog
      ref="send"
      @fetchGroupId="fetchGroupId"
      @fetchPersonId="fetchPersonId"
    />
    <div>
    </div>
  </div>
</template>

<script>
import sendDialog from "../components/sendDialog copy";
//使用步骤 引入以下文件
// import tinymce from 'tinymce/tinymce'
// import Editor from '@tinymce/tinymce-vue'
// import 'tinymce/themes/silver/theme'
// import "tinymce/plugins/colorpicker"; //选择颜色插件
// import "tinymce/plugins/textcolor"; //文本颜色插件
// //引入图标
// import "tinymce/icons/default";

export default {
  components: {
    sendDialog,
    // Editor
  },
  data() {
    return {
      tinymceHtml: "",
      // init: {
      //   language_url: '/static/tinymce/zh_CN.js',//语言包的路径
      //   language: 'zh_CN',//语言
      //   skin_url: "/static/tinymce/skins/ui/oxide",
      //   //content_css可设置编辑区内容展示的css，谨慎使用
      //   content_css:'/static/tinymce/skins/content/dark/content.css',//输入框的样式
      //   // skin_url: '/static/tinymce/skins/ui/oxide-dark',//skin路径
      //   // content_css:'/static/tinymce/skins/content/dark/content.min.css',//输入框的样式
      //   // content_css:'/static/tinymce/skins/content/writer/content.css',
      //   height: 300,//编辑器高度
      //   // branding: false,//是否禁用“Powered by TinyMCE”
      //   // menubar: false,//顶部菜单栏显示
      //   plugins:
      //     "colorpicker textcolor",
      // },
      props: {
        label: "ssName",
        children: "zones",
      },
      list: [{ ssName: "aaa" }],
      count: 1,
      dataList: [],
      checked: false,
    };
  },
  created() {
    // this.getData(1);
  },
 mounted() {
    // tinymce.init({
    //   body_class:"tox-tinymce",
    //   content_style:".tox-tinymce{background:transparent;}",
    //   _style: "div {background-color:transparent;}"
    // });
  },
  methods: {
    btn(){
      console.log(this.tinymceHtml);
    },
    append(node, data) {
      console.log(node, data);
    },
    checkA(a, b) {
      console.log(a, b);
    },
    fetchPersonId(val) {
      console.log(val);
    },
    fetchGroupId(val) {
      console.log(val);
    },
    // handleChangePerson() {
    //   this.$refs.send.init("选择主数据人员");
    // },

    // getData(level) {
    //   let that = this;
    //   let thisData = {
    //     level: level,
    //   };
    //   this.$http({
    //     url: this.$http.adornUrl(`cpcpstorestafflink/getChannelTypeByLevel`),
    //     method: "get",
    //     params: this.$http.adornParams(thisData),
    //   }).then(({ data }) => {
    //     // console.log(data, "datatree");
    //     if (data.code === 0) {
    //       that.dataList = data.data;
    //     }
    //   });
    // },
    handleCheckChange(data, checked, indeterminate) {
      console.info("---data-");
      console.info("当前节点的数据", data);
      console.info("节点本身是否被选中", checked);
      console.info("当前节点子集有没有被选中", indeterminate);
    },
    handleNodeClick(data) {
      console.log("点击节点", data);
    },
    loadNode(node, resolve) {
      console.log("加载节点", node.level, node, resolve);
      let code = node.data ? node.data.ssCode : null;
      this.$http({
        url: this.$http.adornUrl(`cpcpstorestafflink/getChannelTypeByLevel`),
        method: "get",
        params: this.$http.adornParams({
          level: node.level + 1,
          pId: code,
        }),
      }).then(({ data }) => {
        console.log(data, "datatree");
        if (data.code === 0) {
          // let data = data.data ? data.data : []
          return resolve(data.data);
        }
      });
    },
  },
};
</script>
<style scoped lang="scss">
@import "../../../assets/scss/span_color";
.custom-tree-node {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding-right: 8px;
}

</style>
